Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

nice_things/type/create_object.sh

create_object

Since 0.3.0 · Source

import "{ create_object }" from nice_things/type/create_object.sh

Synopsis
create_object <out_var> <class_name> <constructor> [<arg>…]

Configuration

Description
The create_object function can be used to dynamically invoke the constructor of a class at run-time without using the new macro.

The recommended way to create objects is using the new macro which does validation at build-time. The create_object function exists only for those cases when that is not possible, when code is added at run-time, which could not be part of the build process. One example of such a case is when creating objects is needed in macros, since macros are scripts that are added to the build system at run-time, but they are not built themselves.

Options

Operands

  • <out_var>: Output variable; the result will be written to this variable.
  • <class_name>: Name of the class, without namespace prefix.
  • <constructor>: A public constructor function.
  • <arg>: Arguments for the constructor function, if it takes any.

Stdin

Stdout

Stderr

Exit status
0: Successful completion.

Abort

Usage examples

create_object arguments Array Array "$@"